package com.example.enmus;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: bjc
 * Date: 2025-07-24
 * Time: 20:02
 */
public enum BookStatus {
    DELETE(0,"删除"),
    NORMAL(1,"可借阅"),
    FORBIDDEN(2,"不可借阅"),
    ;

    private Integer code;//状态码
    private String desc;//状态描述

    BookStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 根据code返回描述信息
     * @return
     */
    public static BookStatus getDescByCode(Integer code){
        switch (code){
            case 0:return DELETE;
            case 1:return NORMAL;
            case 2:
            default:
                return FORBIDDEN;
        }
    }
    public Integer getCode() {
        return code;
    }
    public void setCode(Integer code) {
        this.code = code;
    }
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        this.desc = desc;
    }
}
